package com.qf.shopping.dao.impl;

import com.qf.shopping.entity.Order;
import com.qf.shopping.dao.IOrderDao;
import com.qf.shopping.utils.Tools;

import javax.print.attribute.standard.OrientationRequested;
import java.util.List;

/**
 * @author 三旬
 * @version 1.0  2022/9/23
 */

public class OrderDaoImpl implements IOrderDao {
    /**
     * 生成订单返回生成的主键
     * @param order
     * @return
     */
    @Override
    public Integer insert(Order order) {
        String sql = "insert into t_order(id,create_time,statu,totalPrice,uid,payType,sendType,toName,phone,address) values(default,now(),?,?,?,?,?,?,?,?)";
        return Tools.insertGetKey(sql, order.getStatu(),order.getTotalPrice(),order.getUid(),order.getPayType(),order.getSendType(),order.getToName(),order.getPhone(),order.getAddress());
    }

    @Override
    public Integer deleteById(Integer id) {
        return null;
    }

    @Override
    public Integer updateById(Order order) {
        return null;
    }

    @Override
    public Order selectOneById(Integer id) {
        return null;
    }

    /**
     * 查询所有的订单数据
     * @return
     */
    @Override
    public List<Order> selectAll() {
        String sql = "select * from t_order";
        return Tools.selectList(sql,Order.class);
    }

    @Override
    public List<Order> selectPage(Integer index, Integer size) {
        return null;
    }

    @Override
    public Integer counts() {
        return null;
    }
}
